<?php
/**
* TopSites - Компонент каталога ссылок для Joostina CMS.
* @author:      Лаборатория сайтов, http://sitelab.net.ru
* @version:     1.9
* @release:     2010.02.07
* @package:     com_topsites
* @copyright:   (C) 2010 http://sitelab.net.ru,  see /administrator/components/com_topsites/copyright.php
* @license:     http://www.gnu.org/copyleft/gpl.html GNU/GPL
**/

defined( '_VALID_MOS' ) or die( '' );

class Admin_HTML_topsites 
{



   function AdminListtopsites( $option, &$rows, &$pageNav ) 
   {
      ?>
	  <form action="index2.php" method="post" name="adminForm">
	  <table width="100%" class="adminheading">
	  <tr>
	  <th class="generic"><?php echo _TL_MENEGER_SITES; ?></th>
	  </tr>
	  </table>  
	  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
	  <tr>
		  <th class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" /></th>
		  <th class="title"><?php echo _TL_LINKS; ?> </th>
		  <th class="title"><?php echo _TL_URL_LINK; ?> </th>
		  <th class="title"><?php echo _TL_DATE_CHECK; ?> </th>
		  <th class="title"><?php echo _TL_LINK_BACK; ?> </th>

		  <th class="title"><?php echo _TL_CATEGORY; ?></th>
		  <th class="title"><?php echo _TL_DATE; ?></th>
		  <th class="title"><?php echo _TL_PUBLISHED; ?></th>
		  <th class="title"><?php echo _TL_OWNER; ?></th>
		  <th class="title"><?php echo _TL_CONTACT_SHORT; ?></th>
	  </tr>
	  <?php
	  $k = 0;
	   for ($i=0; $i < count( $rows ); $i++) 
	  { 
	     $row = $rows[$i]; 
	$images_back=JPATH_SITE.'/administrator/components/com_topsites/images/';
	if ($row->check_back==1){
		//Количество дней с проверки
		$day_ago=round((strtotime(date( "Y-m-d H:i:s" )) - strtotime($row->date_check))/(60*60*24));
		if ($day_ago>20){
			$images_back .="middle.png";
		} else {
			$images_back .="good.png";
		}
        } else {
		$images_back .="bed.png";
	}

?>
		 <tr class="<?php echo "row$k"; $k = 1 - $k; ?>">
		 <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);" /></td>
		 <td><a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')"><?php echo $row->name; ?></a></td>
		 <td><a href="<?php echo $row->url?>"><?php echo $row->url?></a></td>
		 <td align="left"><?php echo strftime ( _DATE_FORMAT_LC2, strtotime ( $row->date_check)); ?></td>
		  <td align="left"><a href="#check" onclick="return listItemTask('cb<?php echo $i;?>','check')"><img src="<?php echo $images_back ?>" border="0"></a></td>
		 <td align="left"><?php echo $row->catname; ?></td>
		 <td align="left"><?php echo strftime ( _DATE_FORMAT_LC2, strtotime ( $row->date)); ?></td>
		 <td align="center">
		 	<?php
		 		$ptask = $row->published ? 'unpublish' : 'publish';
            	$pimg  = $row->published ? 'images/publish_g.png' : 'images/publish_x.png';
			 ?>
			<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i; ?>','<?php echo $ptask;?>')"><img src="<?php echo $pimg;?>" border="0"></a>
		</td>
	  	<td><?php echo $row->username; ?></td>
		<td><?php echo $row->contact; ?></td>
	  </tr>
	  <?php } ?>
	  <?php echo $pageNav->getListFooter(); ?>
	  </table>
	  <input type="hidden" name="option" value="<?php echo $option; ?>" />
	  <input type="hidden" name="task" value="" />
	  <input type="hidden" name="boxchecked" value="0" />
	  </form><?php
	  }  
   
/* ---------------------------------------------------------------------
// Редактируем ссылку
---------------------------------------------------------------------- */	  
function AdminEdittopsites($option, &$row , &$lists, $owner, $userid) {
global $tl_use_editor;
	  			
	  if ( file_exists(topsites_BASE.'/includes/popupimg.js' ))  {
			echo '<script src="'.topsites_URL.'/includes/popupimg.js" type="text/javascript"></script>' ;	}
	?>		   

      <script language="javascript" type="text/javascript">
	  
	  function submitbutton(pressbutton) {
	     var form = document.adminForm;
		 if (pressbutton == 'cancel') 
		 {
		    submitform( pressbutton );
			return;
		 }
	     
	     if (form.catid.value == "0") {	alert( "<?php echo _TL_SELECT_CATEGORY; ?>" ); }
	     else if (form.name.value == "") { alert( "<?php echo _TL_ENTER_NAME; ?>" ); }
	          else if (form.url.value == "") { alert( "<?php echo _TL_ENTER_URL; ?>" ); }
			       else { submitform( pressbutton ); }
	  }
	  
	  function onrefusol(){	        	        
		if( document.adminForm.refusol.disabled == true)
 		  {
			document.adminForm.refusol.disabled = false;
		 	document.adminForm.published.value="0";
		 	document.adminForm.published.disabled = true;	 
		  }
		else {
			document.adminForm.refusol.disabled = true;
   		 	document.adminForm.published.disabled = false;
		}
  	  }
	  // Surrounds the selected text with text1 and text2.
function surroundText(text1, text2, textarea)
{
	// Can a text range be created?
	if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
	{
		var caretPos = textarea.caretPos, temp_length = caretPos.text.length;

		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2;

		if (temp_length == 0)
		{
			caretPos.moveStart("character", -text2.length);
			caretPos.moveEnd("character", -text2.length);
			caretPos.select();
		}
		else
			textarea.focus(caretPos);
	}
	// Mozilla text range wrap.
	else if (typeof(textarea.selectionStart) != "undefined")
	{
	
		var begin = textarea.value.substr(0, textarea.selectionStart);
		var selection = textarea.value.substr(textarea.selectionStart, textarea.selectionEnd - textarea.selectionStart);
		var end = textarea.value.substr(textarea.selectionEnd);
		var newCursorPos = textarea.selectionStart;
		var scrollPos = textarea.scrollTop;

		textarea.value = begin + text1 + selection + text2 + end;

		if (textarea.setSelectionRange)
		{
			if (selection.length == 0)
				textarea.setSelectionRange(newCursorPos + text1.length, newCursorPos + text1.length);
			else
				textarea.setSelectionRange(newCursorPos, newCursorPos + text1.length + selection.length + text2.length);
			textarea.focus();
		}
		textarea.scrollTop = scrollPos;
	}
	// Just put them on the end, then.
	else
	{
		textarea.value += text1 + text2;
		textarea.focus(textarea.value.length - 1);
	}
}
	  </script>  
	  
   <form action="index2.php" method="post" name="adminForm" id="adminForm">
	  <table class="adminheading">
	  <tr>
	  	<th class="edit">
	  		<?php echo _TL_LINK; ?> :
	  		<small><?php echo $row->id ? _TL_EDIT : _TL_NEW;?></small>
	  	</th>
	  </tr>
	  </table>

	<table class="adminform">
    <tr><td>
	  
	<table cellpadding="0" cellspacing="2" border="0" align="left">
      <tr>
	  	<td><div align="right"><?php echo _TL_CATEGORY; ?> :</div></td>
		<td><?php echo $lists['catid']; ?></td>
	  </tr>	  
	  
	  <tr>
      	<td> <div align="right"><?php echo _TL_NAME_LINK ?> :</div></td>
    	<td><input class="inputbox" name="name" type="text" size="50" value="<?php
			if ( !mosGetParam( $_REQUEST, 'name', false ) ) { echo $row->name; }
			else { echo  mosGetParam( $_REQUEST, 'name', '' );}?>" />
		</td>
	  </tr>	   
	  
      <tr>
    	<td><div align="right"><?php echo _TL_URL_LINK ?> :</div></td>
	    <td><input class="inputbox" name="url" type="text" size="50" value="<?php
		  if ( !mosGetParam( $_REQUEST, 'url', false ) ) {echo $row->url; }
		  else {echo mosGetParam( $_REQUEST, 'url', '' );}?>" />
		</td>
      </tr>
 
      <tr>
        <td><div align="right"><?php echo _TL_DESCRIPTION_LINK ?> :</div></td>
        <td>	  
	  	<?php 
		  if (!mosGetParam( $_REQUEST, 'description', false )) $desc = $row->description; 
		  else $desc = mosGetParam( $_REQUEST, 'description', '' );					
		  if ($tl_use_editor) {
		  	// parameters : areaname, content, hidden field, width, height, rows, cols		  
		  	editorArea( 'editor1',  $desc , 'description', '500', '200', '40', '20' ); }
		  else echo '<textarea name="description" cols="50" rows="10" class="inputbox">'.$desc.'</textarea>' ; 
		?>	
		</td>
      </tr>	 
	  
      <tr>
      	<td><div align="right"><?php echo _TL_URL_BACK_LINK ?> :</div></td>
      	<td><input class="inputbox" name="url_back" type="text" size="50" value="<?php
			if ( !mosGetParam( $_REQUEST, 'url_back', false ) ) {echo $row->url_back; }
			else { echo  mosGetParam( $_REQUEST, 'url_back', '' ); }?>" />
		</td>
      </tr>
      <tr>
      	<td><div align="right"><?php echo _TL_CONTACT ?> :</div></td>
      	<td><div float="bottom"><input type="button" value="ICQ" OnClick="surroundText('[ICQ]','[/ICQ]',document.adminForm.contact)">
		<input type="button" value="Email" OnClick="surroundText('[Email]','[/Email]',document.adminForm.contact)"></div>
	<textarea name="contact" cols="50" rows="5"><?php
			if ( !mosGetParam( $_REQUEST, 'contact', false ) ) {echo $row->contact; }
			else { echo  mosGetParam( $_REQUEST, 'contact', '' ); }?></textarea>
		</td>
      </tr>		 
	  
	  <tr>
		<td><div align="right"><?php echo _TL_METAKEY ?> :</div></td>  
		<td><input class="inputbox" name="metakey" type="text" size="50" value="<?php echo $row->metakey; ?>"/></td>
      </tr>	 
	  
	  <tr>
		<td><div align="right"><?php echo _TL_METADESC ?> :</div></td>
		<td><textarea name="metadesc" cols="50" rows="4" class="inputbox"><?php echo $row->metadesc; ?></textarea></td>
      </tr>	 	
	  	  
      <tr>
        <td><div align="right"><?php echo _TL_BANNER_CODE; ?> :</div></td>
        <td><textarea name="bannercode" cols="50" rows="5"><?php
			if ( !mosGetParam( $_REQUEST, 'bannercode', false ) ) {	echo $row->bannercode;}
			else {	echo  mosGetParam( $_REQUEST, 'bannercode', '' );}?></textarea>
		</td>
      </tr>	  
   
	  <?php // если есть картинка - покажем
  	  if ($row->image){ ?>
	  <tr>			  	
		<td><div align="right"><?php echo _TL_IMAGE ?>:</div></td>
	  	<td>
			<a href="javascript: void(0);" onclick="return popup('<?php echo topsites_URL."/adimages/".$row->image; ?>', '<?php echo $row->name ;?>')">
			<img border="0" src="<?php echo topsites_URL."/adimages/thumbs/".$row->image; ?>" class="image-left"  alt="<?php echo $row->name; ?>" style="border: 1px solid #ccc;	margin: 0 10px 10px 5px; padding: 5px;" /></a>
			<input type="hidden" name="image" value="<?php echo $row->image; ?>" />
	  	</td>			
	  </tr>	  
	  <?php } ?>
	  	  
      <tr>
	      <td><div align="right"><?php echo _TL_OWNER; ?> :</div></td>
    	  <td><?php echo $owner; ?>&nbsp;&nbsp;
	  		  <a href="javascript:submitbutton('owner');"><?php echo _TL_CHANGE_THE_OWNER; ?></a>
		  </td>
      </tr>	  
	  
      <tr>
        <td><div align="right"><?php echo _TL_PUBLISHED; ?> :</div></td>
        <td><? echo mosHTML::yesnoSelectList( "published", "", $row->published ); ?></td>
      </tr>	
						
	  <tr>
        <td>&nbsp;</td>
        <td><hr>
			<input type="checkbox" name="refusolcheckbox" value="1" onClick="javascript:onrefusol()"><?php echo _TL_SPECIFY_REASON_REFUSAL_PUBLISH; ?><br>
			<textarea   disabled="disabled" name="refusol" cols="50" rows="5"></textarea>
		</td>
      </tr>	
	  
	  <tr>
      	<td>&nbsp;</td>
      	<td>
	  	  <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
	  	  <input type="hidden" name="userid" value="<?php echo $userid; ?>" />
	  	  <input type="hidden" name="option" value="<?php echo $option; ?>" />
	      <input type="hidden" name="task" value="" />
		 </td>
      </tr>
  
	  </table>
	  
    </td></tr>	  
	</table>
   </form>
	  
	  <?php		 
   }
   
   
   function AdminListUserstopsites(&$rows, $pageNav, $search, $option, $lists, $linkid) {
   
   ?>
	<script language="JavaScript" type="text/javascript">
	function userid(id,pressbutton){
	var id;
	var pressbutton;
	document.adminForm.userid.value = id;
	submitbutton(pressbutton);
	}
	</script>

   <form action="index2.php" method="post" name="adminForm">

		<table class="adminheading">
		<tr>
			<th class="user"><?php echo _TL_CHANGE_OWNER_LINK; ?> </th>
			<td>Фильтр:</td>
			<td><input type="text" name="search" value="<?php echo htmlspecialchars( $search );?>" class="inputbox" /></td>
			<td width="right"><?php echo $lists['type'];?></td>
			<td width="right"><?php echo $lists['logged'];?></td>
		    <td width="right">
				<label><input name="searchbutton" type="button"  value="Поиск" class="button" onclick="javascript:submitbutton('owner');" /></label>
			</td>
		</tr>
		</table>

		<table border="0" class="adminlist">
		<tr>
			<th width="10" class="title">#</th>
			<th width="90%" class="title">Имя</th>
			<th class="title">Логин</th>
			<th class="title">E-Mail</th>
			<th class="title">ID</th>
		    <th class="title">Назначить</th>
		</tr>
		<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row 	=& $rows[$i];

			$img 	= $row->block ? 'publish_x.png' : 'tick.png';
			$task 	= $row->block ? 'unblock' : 'block';
			$alt 	= $row->block ? 'Разрешить' : 'Блокировать';
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td><?php echo $i+1+$pageNav->limitstart;?></td>
				<td><?php echo $row->name; ?></td>				
				<td><?php echo $row->username; ?></td>
				<td><a href="mailto:<?php echo $row->email; ?>"><?php echo $row->email; ?></a></td>
				<td align="left"><?php echo $row->id; ?></td>
			    <td align="left"><a href="javascript:userid(<?php echo $row->id;?>,'edit')">Выбор</a></td>
			</tr>
			<?php
			$k = 1 - $k;
		}
		?>
	 </table>
		<?php echo $pageNav->getListFooter(); ?>
					
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="cid" value="<?php if ( !mosGetParam( $_REQUEST, 'id', false ) ){
													 echo mosGetParam( $_REQUEST, 'cid', '');
													 }
													 else {
													 echo  mosGetParam( $_REQUEST, 'id', '' );
													 }
													  ;?>" />
		<input type="hidden" name="name" value="<?php echo mosGetParam( $_REQUEST, 'name', '' );?>" />
		<input type="hidden" name="url" value="<?php echo mosGetParam( $_REQUEST, 'url', '' );?>" />
		<input type="hidden" name="description" value="<?php echo mosGetParam( $_REQUEST, 'description', '' );?>" />
		<input type="hidden" name="url_back" value="<?php echo mosGetParam( $_REQUEST, 'url_back', '' );?>" />
		<input type="hidden" name="bannercode" value="<?php echo mosGetParam( $_REQUEST, 'bannercode', '' );?>" />
		<input type="hidden" name="refusolcheckbox" value="<?php echo mosGetParam( $_REQUEST, 'refusolcheckbox', '' );?>" />
		<input type="hidden" name="userid" value="<?php echo $userid; ?>" />
		<input type="hidden" name="task" value="owner" />
		</form>
		
		<?php
   
   }
   
   
   function AdminListCategoriestopsites($option,$pageNav,&$rows) 
   { ?>
    <form action="index2.php" method="post" name="adminForm">
	<table width="100%" class="adminheading">
	  <tr>
		<th class="categories"><?php echo _TL_CATEGORIES; ?></th>
	  </tr>
	  </table>  
	  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
	  <tr align="left">
	  	<th class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" /></th>
	  	<th class="title"><?php echo _TL_CATNAME; ?></th>
	  	<th class="title"><?php echo _TL_CAT_PARENT; ?></th>
		<th class="title"><?php echo _TL_ACCESS; ?></th>
	  	<th class="title" colspan="2"><?php echo _TL_ORDER; ?></th>
	  	<th class="title"><?php echo _TL_PUBLISHED; ?></th>
	  </tr><?php
	  $k = 0;
	  for ($i=0, $n=count( $rows ); $i < $n; $i++) 
	  {
	     $row = $rows[$i];
		 $access = mosCommonHTML::AccessProcessing( $row, $i );  ?>
		 <tr class="<?php echo "row$k"; $k = 1 - $k; ?>">
		 <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);" /></td>
		 <td><a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')"><?php echo $row->name; ?></a></td>
		 <td><?php foreach ($rows as $r) { 
			 if($r->id === $row->cat_parent){
				 echo $r->name; 
				 break;
			 } 
		 } ?></td>
		 <td><?php echo $access; ?></td>
		 <td><?php echo $pageNav->orderUpIcon( $i ); ?></td>
		 <td><?php echo $pageNav->orderDownIcon( $i, $n ); ?></td>
		 <td><?php
		 		$ptask = $row->published ? 'unpublish' : 'publish';
            	$pimg  = $row->published ? 'images/publish_g.png' : 'images/publish_x.png';
			 ?>
			<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $ptask; ?>')"><img src="<?php echo $pimg; ?>" border="0" /></a>		 	
		 </td>
		 </tr>
		 <?php } ?>
      	 <?php echo $pageNav->getListFooter(); ?>
	  </table>
      <input type="hidden" name="option" value="<?php echo $option; ?>" />
      <input type="hidden" name="task" value="" />
      <input type="hidden" name="act" value="categories" />
	  <input type="hidden" name="boxchecked" value="0" />
      <input type="hidden" name="name" value="<?php echo mosGetParam( $_REQUEST, 'name', '' );?>" />
	  </form><?php
   }

   function AdminEditCategoriestopsites($option,&$row,&$lists)
   { ?>
      <script language="javascript" type="text/javascript">
	  
	  function submitbutton(pressbutton) 
      {
	     var form = document.adminForm;
		 if (pressbutton == 'cancel') 
		 {
		    submitform( pressbutton );
			return;
		 }
	     // do field validation
	     if (form.name.value == "") { alert( "<?php echo _TL_ENTER_CATNAME; ?>" ); }	     
		 else { submitform( pressbutton ); }
      }
	  
	  </script>
	  
	  <form action="index2.php" method="post" name="adminForm" id="adminForm">
      <table class="adminheading">
      <tr><th class="edit">
	  <?php echo _TL_CATEGORY; ?> :
	  <small><?php echo $row->id ? _TL_EDIT : _TL_NEW_CATEGORY;?></small>
	  </th>
      </tr>
      </table>	
	  
      <table class="adminform">
      <tr>
      <td>
      <table align="left">
      <tr>
      <td><div align="right"><?php echo _TL_CATNAME; ?> : </div></td>
      <td colspan="2"><input name="name" type="text" value="<?php echo $row->name; ?>" size="40" /></td>
      </tr>
      <tr>

      <tr>
      	<td><div align="right"><?php echo _TL_CAT_PARENT; ?> : </div></td>
      	<td colspan="2"><?php echo $lists['categories']; ?></td>
      </tr>
	  
      <tr>
	    <td> <div align="right"><?php echo _TL_IMAGE; ?> : </div></td>
    	<td colspan="2"><?php echo $lists['image']; ?></td>
      </tr>
	  
      <tr>
      	<td></td>
	  	<td colspan="2" width="60" height="60">
	  	<script language="javascript" type="text/javascript">
	  		if (document.forms['adminForm'].image.options.value!='')
	  			 { jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'image' ); }
		  	else { jsimg='../images/M_images/blank.png'; }
	  		document.write('<img src=' + jsimg + ' name="imagelib" width="50" height="50" border="1" alt="Предпросмотр" />');
		</script>
		</td>
      </tr>
      
	  <tr>
      	<td><div align="right"><?php echo _TL_ACCESS; ?> : </div></td>
      	<td><?php echo $lists['access']; ?></td>
      </tr>
      <tr>
   	   	<td><div align="right"><?php echo _TL_DESCRIPTION_LINK ?> : </div></td>
    	<td colspan="2">
		 	 <textarea name="description" cols="50" rows="5" class="inputbox"><?php echo $row->description; ?></textarea>
	 	</td>
      </tr>
      <tr>
      	<td><div align="right">Сортировка : </div></td>
      	<td colspan="2"><?php echo $lists['ordering']; ?></td>
      </tr>
      <tr>
      	<td><div align="right"><?php echo _TL_PUBLISHED.' :'; ?></div></td>
      	<td colspan="2"><?php echo mosHTML::yesnoSelectList( "published", "", $row->published ); ?></td>
      </tr>
      <tr>
      	<td>&nbsp;</td>
      	<td colspan="2">
	  <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
      <input type="hidden" name="option" value="<?php echo $option; ?>" />
      <input type="hidden" name="act" value="categories" />
	  <input type="hidden" name="task" value="" />	  </td>
      </tr>
      </table>
      </td>
      </tr>
      </table>
	  </form> <?php
   }  

function AdminListSettingstopsites($option,$Users) {
	  
	  require_once(topsites_ADMIN."/topsites.config.php");
	  $l_tl_visitors_can_add = mosHTML::yesnoSelectList( 'tl_visitors_can_add','class="inputbox" size="1"',$tl_visitors_can_add );	  
  	  $l_tl_to_demand_link_back = mosHTML::yesnoSelectList( 'tl_to_demand_link_back','class="inputbox" size="1" ',$tl_to_demand_link_back );

  	  $l_tl_show_backurl =  mosHTML::yesnoSelectList( 'tl_show_backurl','class="inputbox" size="1"',$tl_show_backurl );
	  $l_tl_use_editor =  	mosHTML::yesnoSelectList( 'tl_use_editor','class="inputbox" size="1"', $tl_use_editor );
  	  $l_tl_show_hits =  	mosHTML::yesnoSelectList( 'tl_show_hits','class="inputbox" size="1"', $tl_show_hits );
  	  $l_tl_show_tophits =  mosHTML::yesnoSelectList( 'tl_show_tophits','class="inputbox" size="1"', $tl_show_tophits );
	  $l_tl_show_toolbar =  mosHTML::yesnoSelectList( 'tl_show_toolbar','class="inputbox" size="1"', $tl_show_toolbar );
	  $l_tl_show_subcats =  mosHTML::yesnoSelectList( 'tl_show_subcats','class="inputbox" size="1"', $tl_show_subcats ); 		  	    $l_tl_ask_contact =   mosHTML::yesnoSelectList( 'tl_ask_contact','class="inputbox" size="1"',$tl_ask_contact );		
	  ?>
	  <script language="javascript" type="text/javascript">
	  function onсhecklinkback(){						         	        
		if( document.adminForm.tl_to_demand_link_back.value == 1 ){
			document.adminForm.сheck_link.disabled = false;	}
		else { document.adminForm.сheck_link.disabled = true; }
	  }
	  </script>	
	   
	<table class="adminheading">
  		<tr><th class="config"><?php echo _TL_SETTINGS; ?>: </th></tr>
	</table>    

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr><td>
	  <form id="settingsform" name="adminForm" method="post" action="index2.php">
		<?php
			$tabs = new mosTabs( 1 );
			$tabs->startPane( $option );
			$tabs->startTab(_TL_COMMON, "common");
		?>
	   <table class="adminform" width="100%">
	   <tr valign="top">
	   <td>
  	      <table class="adminform" width="100%">
  	 		<tr>
			  <td width="300"><?php echo _TL_COL_COUNT ?>:</td>
			  <td><input name="numOfColumns" type="text" value="<?php echo $numOfColumns; ?>" size="5" /></td>
	  		</tr>

	  		<tr>
			  <td><?php echo _TL_USE_EDITOR ?>:</td>
			  <td><?php echo $l_tl_use_editor ?></td>
		    </tr>
					   
			<tr>		   
			  <td>Показать панель:</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_show_toolbar','class="inputbox" size="1"', $tl_show_toolbar ); ?></td>
		    </tr>							 
			

			<tr>
			  <td><?php echo _TL_VISITORS_CAN_ADD; ?>:</td>
			  <td><?php echo $l_tl_visitors_can_add; ?></td>
			</tr>		   
	  
	  		<tr>
			  <td><?php echo _TL_QUANTITY_OF_SITES_ON_PAGE; ?>:</td>
			  <td><input name="tl_limit" type="text" value=<?php echo $tl_limit; ?> size="5" /></td>
		    </tr>	
	  
		    <tr>
			  <td><?php echo _TL_LENGHT_DESCR; ?>:</td>
			  <td><input name="tl_lenght" type="text" value=<?php echo $tl_lenght; ?> size="5" /></td>
		    </tr>
		  </table>			   
		</td>	  
		
		<td> 			   
		  <table  class="adminform" width="100%">
		    <tr>
			  <td><?php echo _TL_SHOW_HITS; ?>:</td>
			  <td><?php echo $l_tl_show_hits; ?></td>
		    </tr>
		    <tr>
			  <td><?php echo _TL_SHOW_TOPHITS; ?>:</td>
			  <td><?php echo $l_tl_show_tophits; ?></td>
		    </tr>
		    <tr>
			  <td><?php echo _TL_MAX_TOPHITS; ?>:</td>
			  <td><input name="tl_max_tophits" type="text"  size="5" value="<?php echo $tl_max_tophits; ?>" /></td>
		    </tr>
		    <tr>
			  <td><?php echo _TL_SHOW_SUBCATS; ?>:</td>
			  <td><?php echo $l_tl_show_subcats; ?></td>
		    </tr>
		    <tr>			  
			  <td><?php echo _TL_MAX_SUBCATS_TO_DISPLAY; ?>:</td>
			  <td><input name="numOfSubcatsToDisplay" type="text"  size="5" value="<?php echo $numOfSubcatsToDisplay; ?>" /></td>
		    </tr>
		  </table>			   
		</td></tr>
		</table>			  

		<?php
			$tabs->endTab(); 					
			// ---- Добавление сайта -------------------------------
			$tabs->startTab(_TL_LINKS, "sites");			
		?>
  		<table class="adminform" width="100%">
		    <tr>
			  <td width="300">Использовать MetaKey:</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_use_metakey','class="inputbox" size="1"', $tl_use_metakey); ?></td>
		    </tr>
	  
		    <tr>
			  <td>Использовать MetaDesc:</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_use_metadesc','class="inputbox" size="1"', $tl_use_metadesc); ?></td>
		    </tr>

		    <tr>
			  <td>Использовать код для баннера:</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_use_bannercode','class="inputbox" size="1"', $tl_use_bannercode); ?></td>
		    </tr>
						
		    <tr>
			  <td>Запрашивать e-mail (для гостей):</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_ask_email','class="inputbox" size="1"', $tl_ask_email); ?></td>
		    </tr>

		    <tr>
			  <td>Использовать CAPTCHA (для гостей):</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_use_captcha','class="inputbox" size="1"', $tl_use_captcha); ?></td>
		    </tr>
		     <tr>
			  <td>Использовать контакты владельца (для гостей):</td>
			  <td><?php echo mosHTML::yesnoSelectList( 'tl_ask_contact','class="inputbox" size="1"', $tl_ask_contact); ?></td>
		    </tr>

	    </table>
			 
		<?php
			$tabs->endTab(); 						
			// ---- Обратная ссылка -------------------------------
			$tabs->startTab(_TL_BACK_URL, "backurl");
			// Обратная ссылка
		?>
  		<table class="adminform" width="100%" cellpadding="5">
		    <tr>
			  <td width="300">Требовоть размещения обратной ссылки:</td>
			  <td><?php echo $l_tl_to_demand_link_back; ?></td>
		    </tr>
	  
		    <tr>
			  <td>Показать свои ссылки:</td>
			  <td><?php echo $l_tl_show_backurl; ?></td>
		    </tr>						

		    <tr>
			  <td>Текст для обратной ссыли:</td>
			  <td><textarea name="tl_text_for_backurl" cols="50" rows="5" class="inputbox"><?php echo $tl_text_for_backurl; ?></textarea></td>
		    </tr>
			
		    <tr>
			  <td>Вариант ссылки 1:</td>
			  <td><textarea name="tl_link_back" cols="50" rows="5" class="inputbox"><?php echo $tl_link_back; ?></textarea></td>
		    </tr>
		
		    <tr>
			  <td>Вариант ссылки 2:</td>
		      <td><textarea name="tl_link_back_2" cols="50" rows="5" class="inputbox"><?php echo $tl_link_back_2; ?></textarea></td>
		    </tr>
		  
	  	    <tr>
	   		  <td>Что проверять?:</td>																																								
  	    	  <td><textarea name="сheck_link" cols="50" rows="5" class="inputbox"><?php echo $сheck_link; ?></textarea></td>
	        </tr>

		    <tr>
	    	  <td>E-mail по умолчанию:</td>
	    	  <td><input type="text" name="tl_email_default" value=<?php echo $tl_email_default; ?> ></td>
	        </tr>
	    </table>														
		
		<?php
			$tabs->endTab(); 									  
			// ---- параметры для изображений --------------------------
			$tabs->startTab('&nbsp;'._TL_IMAGE.'&nbsp;', "image");			
		?>					 
	  	<table class="adminform" width="100%">
  	 		<tr>
			  <td width="300"><?php echo _TL_DEF_IMG_SIZE ?>:</td>
			  <td>
			  	<input name="def_img_size_x" type="text" value="<?php echo $def_img_size_x; ?>" size="5" />&nbsp;X&nbsp;
				<input name="def_img_size_y" type="text" value="<?php echo $def_img_size_y; ?>" size="5" />
			  </td>
	  		</tr> 
			
  	 		<tr>					 
			  <td><?php echo _TL_DEF_IMG_THUMB_SIZE ?>:</td>
			  <td>
			  	<input name="def_img_thumb_size_x" type="text" value="<?php echo $def_img_thumb_size_x; ?>" size="5" />&nbsp;X&nbsp;
				<input name="def_img_thumb_size_y" type="text" value="<?php echo $def_img_thumb_size_y; ?>" size="5" />
			  </td>
	  		</tr>  

	  		<tr>
			  <td><?php echo _TL_SAVE_IMG_QUALITY ?>:</td>
			  <td><input name="save_img_quality" type="text" value="<?php echo $save_img_quality; ?>" size="5" /></td>
		    </tr>		   
	    </table>							  											  
		<?php
			$tabs->endTab();	
			// ------- Доступ -----------------
$tabs->startTab('&nbsp;'._TL_ACCESS.'&nbsp;', "Доступ");
		$countUser=count($Users)+1;
		// А нафига нам длинный select		
		if ($countUser>15) $countUser=15;
		?>					 
	  	<table class="adminform" width="100%">
  	 		<tr>
			  <td width="300"><?php echo _TL_ACCESS_USER_INFO ?>:</td>
			  <td><select class="inputbox" size="<?php echo $countUser?>" name="Users[]" multiple>
			  	<option value=""> - </option>
				<?
				foreach ($Users as $User){
				?>
				<option value="<?php echo $User->id ?>" <? if (!empty($User->access)) echo 'selected'?> ><?php echo $User->name ?></option>
				<?
				}
				?>
			      </select>	
			  </td>
	  		</tr> 
	    </table>							  											  
		<?php
			$tabs->endTab();
			$tabs->endPane();
		?>									  
			  
	  	<input type="hidden" name="option" value="<?php echo $option; ?>" />
	  	<input type="hidden" name="task" value="" />
	  	<input type="hidden" name="act" value="settings" />
	  </form>
	  
	</td></tr>  
</table>	  
	  <?php

   }



}
?>
